﻿using System;
using System.Collections.Generic;
using System.Linq;
using DataModel.Managers;

namespace UniversityPortal
{
    public class ScheduleService : IScheduleService
    {
        public IEnumerable<Lesson> GetTodaySchedule(int groupNumber)
        {
            var manager = new ScheduleManager();
            var modelList = manager.GetScheduleByGroup(groupNumber, DateTime.Today, DateTime.Today);

            return modelList.dayModels[0].lessonModels.Select(lessonModel => new Lesson
                {
                    Auditory = lessonModel.Auditory.FullName,
                    Begin = lessonModel.BeginTime,
                    End = lessonModel.EndTime,
                    Name = lessonModel.Subject.fullName,
                    Professor = lessonModel.Professor.User.ShortName,
                    Type = lessonModel.LessonType.name
                }).ToList();
        }

        public IEnumerable<Lesson> GetActualSchedule(int groupNumber)
        {
            throw new NotImplementedException();
        }
    }
}
